package com.hzz.dao.user;

import com.hzz.framework.dao.IBaseDao;
import com.hzz.framework.entity.IEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * <p> 数据库处理接口类。
 */
@Mapper
public interface IAuthUserVsRoleDao extends IBaseDao {

    /**
     * 判断是否存在
     */
    @Override
    @Select("select IFNULL(count(0),0) as count from auth_user_vs_role where  user_id = #{userId} and  role_id = #{roleId} ")
    int isDataExist(IEntity entity) throws Exception;

    /**
     * 根据主键 物理删除
     */
    @Override
    @Delete("delete from auth_user_vs_role where  user_id = #{userId} and  role_id = #{roleId} ")
    int deleteByPrimaryKey(IEntity entity) throws Exception;

    /**
     * 根据主键user_id 物理删除
     */
    @Delete("delete from auth_user_vs_role where  user_id = #{userId}")
    int deleteBulkDataByUserId(IEntity entity) throws Exception;

    /**
     * 根据主键role_id 物理删除
     */
    @Delete("delete from auth_user_vs_role where  role_id = #{roleId}")
    int deleteBulkDataByRoleId(IEntity entity) throws Exception;


    List<?> findUserRoleIsList(IEntity entity) throws Exception;

    List<?> findOrgRoleIsList(IEntity entity) throws Exception;
    
    /**
     * 根据角色id获取用户列表
     */
    List<?> findUserByRoleIsList(IEntity entity) throws Exception;
}